package edu.geo.spaghetti;

import java.io.Serializable;
import java.util.List;

import edu.geo.containers.geom.impl.LineSegment;
import edu.geo.containers.geom.impl.Point;
import edu.geo.containers.geom.impl.Polygon;
/**
 * Esta clase almacena la representación Spaghetti de un dominio geométrico.
 * 
 * @author Alejo
 *
 */
public class SpaghettiRepresentation implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2566073432877901542L;
	private int id;
	private List<Polygon> polygons;
	private List<Point> points;
	private List<LineSegment> lineSegments;
	private String strid = "A";
	
	
	
	public SpaghettiRepresentation() {
		super();
		int charValue = strid.charAt(0);
		strid = String.valueOf( (char) (charValue - 1 ));	
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public List<Polygon> getPolygons() {
		return polygons;
	}
	public void setPolygons(List<Polygon> polygons) {
		this.polygons = polygons;
		for (Polygon pol: this.polygons)
		{
			getNextStrId();
			pol.setStrId(strid);	
		}		
	}
	public List<Point> getPoints() {
		return points;
	}
	
	public void setPoints(List<Point> points) {
		this.points = points;
		for (Point point : this.points)
		{
			getNextStrId();
			point.setStrId(strid);	
		}
	}
	public List<LineSegment> getLineSegments() {
		return lineSegments;		
		
	}
	public void setLineSegments(List<LineSegment> lineSegments) {
		this.lineSegments = lineSegments;
		for (LineSegment lineSegment : this.lineSegments)
		{
			getNextStrId();
			lineSegment.setStrId(strid);	
		}	
	}	
	
	public String getNextStrId()
	{	
		int charValue = strid.charAt(0);
		strid = String.valueOf( (char) (charValue + 1));
		return strid;
	}

	

}
